package com.example.demo2.service.impl;

import com.example.demo2.dao.TestMapper;
import com.example.demo2.service.ICheckService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class CheckServiceImpl implements ICheckService {
    @Autowired
    private TestMapper testMapper;

    @Override
    public void check() {
        List<Map<String, Object>> list = testMapper.selectAll();
        log.info("");
        log.info("----------------");
        log.info("id     name");
        for (Map<String, Object> map : list) {
            log.info("{}     {}", map.get("id"), map.get("name"));
        }
        if (list.size() == 0) {
            log.info("没有数据");
        }
        log.info("----------------");
        log.info("test1 size: {}", list.size());
        log.info("----------------");
    }
}
